package com.ztf666.utils;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * @Author ztf
 * @Date 20:29 2022/1/17
 * 连接工具类
 **/
public class ConnectionUtils {
    public static RestHighLevelClient getClient(){
        HttpHost httpHost = new HttpHost("101.34.27.156", 9200);
        RestClientBuilder clientBuilder = RestClient.builder(httpHost);
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(clientBuilder);
        return restHighLevelClient;
    }
}
